﻿using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public enum GameSkill {
	None = 0,
	Freeze = 1, //skip turn
	Chain = 2,	//chain attack
	Crush = 3,	//play on another
	Shield = 4,	//resist 2+ attacks
	Wall = 5,	//resist attack, except powerups
	Boost = 6,	//increase value of neighbours
	Drain = 7, 	//reduce value of neighbours
	MaxSkills 	//keep at the end
};

public enum GamePower {
	None = 0,
	Destroy = 1, //remove enemy unit
	Replay = 2,	//play owned unit again
	Teleport = 3, //move owned unit
	TakeOver = 4, //turn enemy unit and attack
	Bubble = 5, //lock neighbour cells for N turns
	MaxPowerUps //keep at the end
};

[System.Serializable]
public class GameUnit {
	public int level = 0;
	
	//private bool flipped = false;
	//private int[] values = new int[3]; //values for all sides
	public GameSkill skill = GameSkill.None;
	public int skillLevel = 0;
	
	public void setValues() {
	}
	
	public void setValues(int value1, int value2, int value3, bool flipped) {
	}
	
	public void getValueAt(int side) {
		//return value for a side (using the flipped attribute)
	}
}

[System.Serializable]
public class GamePowerUp {
	public GamePower power = GamePower.None;
	public int level;
}

//the selection of units
[System.Serializable]
public class GameTeam {
	public List<GameUnit> units = new List<GameUnit>();
	public List<GamePowerUp> powerups = new List<GamePowerUp>();
}

//all units + unit selections
[System.Serializable]
public class GamePool {
	static public GamePool playerPool = new GamePool();
	static public GameTeam currentTeam = null; //current team

	//TODO- slots for units
	//TODO- max team size for units and powerups
	public List<GameUnit> units = new List<GameUnit>();
	public List<GameTeam> teams = new List<GameTeam>();
	public int teamIndex = 0; //index for active team
	public int enemyTeamIndex = 0; //index for enemy team if playing local
}

//game fields
[System.Serializable]
public class GameField {
	public int size;
	public List<int> lockedCells = new List<int>();
}

[System.Serializable]
public class GameFieldSet {
	static public GameFieldSet playerFields = new GameFieldSet();
	static public GameField activeField;
	
	public List<GameField> fields = new List<GameField>();
	public int fieldIndex = 0;
}
